﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using ServiceMessages.ResponsePOCOs;
using ServiceMessages.RequestPOCOs;
using System.IO;

namespace WCFServiceWebRole1
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IConvo
    {
        
        [WebInvoke(Method="POST", UriTemplate = "LoginUser",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        [OperationContract]
        LoginResponse loginUser(string email, string password);

        [WebInvoke(Method = "POST", UriTemplate = "RegisterUser",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        LoginResponse registerUser(RegistrationRequest r);

        [WebInvoke(Method = "POST", UriTemplate = "EditProfile",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        LoginResponse editProfile(EditProfileRequest e);

        [WebGet(UriTemplate = "GetFriends?userId={userId}",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        List<FriendResponse> getFriends(int userId);

        [WebInvoke(Method = "POST", UriTemplate = "RemoveFriend",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        MessageResponse removeFriend(RemoveFriendRequest r);

        [WebGet(UriTemplate = "GetGroups?userId={userId}",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        List<GroupResponse> getGroups(int userId);

        [WebInvoke(Method = "POST", UriTemplate = "LeaveGroup",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        MessageResponse leaveGroup(LeaveGroupRequest c);

        [WebGet(UriTemplate = "RequestFriend?requesterId={requesterId}&requesteeId={requesteeId}",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        MessageResponse requestFriend(int requesterId, int requesteeId);

        [WebGet(UriTemplate = "AcceptFriend?accepterId={accepterId}&accepteeId={accepteeId}",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        MessageResponse acceptFriend(int accepterId, int accepteeId);

        [WebGet(UriTemplate = "GetChat?userId={userId}",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        SetupChatResponse getChat(int userId);

        [WebGet(UriTemplate = "GetGroupChat?groupId={groupId}",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        SetupChatResponse getGroupChat(int groupId);

        [WebInvoke(Method = "POST", UriTemplate = "SearchUsers",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        List<FriendResponse> searchUsers(SearchUsersRequest s);

        [WebGet(UriTemplate = "GetLocations?userId={userId}",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        List<LocationResponse> getLocations(int userId);

        [WebInvoke(Method = "POST", UriTemplate = "UpdateStatus",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        [OperationContract]
        MessageResponse updateStatus(int userId, string status);

        [WebInvoke(Method = "POST", UriTemplate = "UpdateEndpoint",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        [OperationContract]
        MessageResponse updateEndpoint(int userId, string endpoint);

        [WebInvoke(Method = "POST", UriTemplate = "UpdateLocation",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        [OperationContract]
        MessageResponse updateLocation(int userId, double latitude, double longitude);

        [WebInvoke(Method = "POST", UriTemplate = "CreateGroup",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        MessageResponse createGroup(CreateGroupRequest c);

        [WebInvoke(Method = "POST", UriTemplate = "SaveMessage",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare)]
        [OperationContract]
        MessageResponse saveMessage(SaveMessageRequest s);

        [OperationContract]
        CompositeType GetDataUsingDataContract(CompositeType composite);

        // TODO: Add your service operations here
    }


    // Use a data contract as illustrated in the sample below to add composite types to service operations.
    [DataContract]
    public class CompositeType
    {
        bool boolValue = true;
        string stringValue = "Hello ";

        [DataMember]
        public bool BoolValue
        {
            get { return boolValue; }
            set { boolValue = value; }
        }

        [DataMember]
        public string StringValue
        {
            get { return stringValue; }
            set { stringValue = value; }
        }
    }
}
